<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>DOM操作CSS</title>
		<style>
			p.cls1 {
				color: red;
				font-weight: bolder;
				font-size: 80px;
				font-family: "隶书";
			}
			
			p.cls2 {
				color: green;
				font-weight: bolder;
				font-size: 100px;
				font-family: "黑体";
			}
		</style>
	</head>
	<body>
		<p class="cls1">这是一段文字</p>

		<script>
			//JS切换不同的样式表
			document.getElementsByTagName("p")[0].onclick = function(){
				//逐个修改样式
				/* this.style.color = "green";
				this.style.fontWeight = "bolder";
				this.style.fontSize = "100px";
				this.style.fontFamily = "黑体"; */
				
				//统一替换一整套样式
				this.className = "cls2";
			}
		</script>
	</body>
</html>
